﻿using System;
using ContentAppBase.Model;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;

namespace ContentAppBase.Utils
{
    public class GroupInfoListToGroupHeaderButtonStyleConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            if (value is GroupInfoList<object> && ((GroupInfoList<object>)value).Count > 0)
            {
                var firstItem = ((GroupInfoList<object>)value)[0];
                if (firstItem is SimpleItem && ((SimpleItem)firstItem).Type == SimpleItemType.ImageResults || firstItem is SimpleItem && ((SimpleItem)firstItem).Type == SimpleItemType.WebResults)
                    return Application.Current.Resources["TextPrimaryButtonStyle"];
            }

            return Application.Current.Resources["InactiveTextPrimaryButtonStyle"];
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            throw new NotImplementedException();
        }
    }
}
